package com.nb.cloud.doc.enums;

import lombok.AllArgsConstructor;
import lombok.Getter;

import java.util.Objects;

/**
 * 年级
 * @author lihaoyang6
 * @date 2024年07月18日 14:32
 */
@Getter
@AllArgsConstructor
public enum GradeEnum {

    ONE(1,"一年级"),
    TWO(2,"二年级"),
    THREE(3,"三年级"),
    FOUR(4,"四年级"),
    FIVE(5,"五年级"),
    SIX(6,"六年级"),
    ;

    private final Integer code;

    private final String text;

    public static GradeEnum getByCode(Integer code){
        if(Objects.isNull(code)){
            return null;
        }
        for(GradeEnum ge : GradeEnum.values()){
            if(ge.code == code){
                return ge;
            }
        }
        return null;
    }
}
